﻿namespace Arms.Framework.Security.Encryptors
{
    public static class EncryptorFactory
    {
        private static IEncryptorFactory _currentEncryptor = null;

        /// <summary>
        /// Sets the current encryptor to use.
        /// </summary>
        /// <param name="currentEncryptor"></param>
        public static void SetCurrent(IEncryptorFactory encryptor)
        {
            _currentEncryptor = encryptor;
        }

        /// <summary>
        /// Creates a new IEncryptor.
        /// </summary>
        /// <returns></returns>
        public static IEncryptor Encryptor
        {
            get { return (_currentEncryptor != null) ? _currentEncryptor.Create() : null; }
        }
    }
}
